#ifndef __ACCTPTOR_H__
#define __ACCTPTOR_H__

#include "InetAddress.h"
#include "Socket.h"
#include <string>

class Acceptor
{
public:
    Acceptor(const string &ip, unsigned short port);
    ~Acceptor();
    void ready();
    int accept();

    // 获取套接字描述符：返回当前对象关联的套接字描述符
    int fd() const;  
    
private:
    void setReuseAddr();
    void setReusePort();
    void bind();
    void listen();
     
private:
    Socket _sock;
    InetAddress _addr;
};

#endif 